package janela;

import java.applet.Applet;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MeuAppletV2 extends Applet {

    private Label l1 = new Label("+"), l2 = new Label("Resp");
    private TextField t1 = new TextField(" "), t2 = new TextField(" ");
    private Button b1 = new Button(" = ");

    public void init() {
        setLayout(new FlowLayout());
        add(t1);
        add(l1);
        add(t2);
        add(b1);
        add(l2);
        b1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                Integer i1 = new Integer(t1.getText().trim());
                Integer i2 = new Integer(t2.getText().trim());
                l2.setText(new Integer(i1 + i2).toString());
            }
        });


    }
}
